<?php

/**
 * @author    Vtem.net
 * @copyright Copyright (C) 2011 Vtem.net. All rights reserved.
 * @license   GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
 */
// No direct access
defined('JPATH_BASE') or die;

jimport('joomla.html.html');
jimport('joomla.form.formfield');

class JFormFieldCategory extends JFormField {

    protected $type = 'Category';

    protected function getInput() {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        // Initialize variables.
        $html = array();
        $attr = '';
        $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        
        // Build the query for the ordering list.
        $where = array();
        $where[] = 'a.published = 1';
        $campuses = CprojectDBHelper::getCprojectCategories($sql = false, $where, $order = array(), 0, array('a.id'));


        $html = JHtml::_('select.genericlist', $campuses, $this->name, trim($attr), 'id', 'name', $this->value);

        return $html;
    }

}